package 高级特性;

public class Workc implements Runnable {

    private int number = 80;  //鎬诲叡80浠藉涔犵瑪璁�
    private int count = 0;    //鍙戠鍑犱唤

    @Override
    public void run() {
        while (true) {
            synchronized (this) {
                if (number <= 0) {
                    break;
                }
                try {
                    Thread.sleep(400);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                number--;
                count++;
                System.out.println(Thread.currentThread().getName() + "发" + count + "笔记，还有" + number + "份笔记");
            }
        }
    }

    public static void main(String[] args) {
       Workc Workc = new Workc();
        new Thread(Workc, "A老师").start();
        new Thread(Workc, "B老师").start();
        new Thread(Workc, "C老师").start();
    }
}
